package Leetcode.array;

import java.util.*;

public class IsDuplicate {
    public boolean containsDuplicate(int[] nums) {
        Arrays.sort(nums);
        for(int i=1;i<nums.length;i++){
            if(nums[i]==nums[i-1])
                return true;
        }
     return false;
    }

    public static void main(String[] args) {
        int[] a={1,2,3,4,5,4};
        IsDuplicate isDuplicate=new IsDuplicate();
        System.out.println(isDuplicate.containsDuplicate(a));
    }
}
